import express from "express";
const paperRouter = express.Router();
import auth from "../../common/middleware/auth";
import paperCont from "./controller";
import classMidd from '../class/middleware'
import paperMidd from './middleware'
/**
 * 创建答卷
 */
paperRouter.post("/create", auth.vertify, paperMidd.isPaperExistByName, classMidd.isClassExistFromId, paperCont.createPaper);

/**
 * 获取教师创建的所有答卷
 */
paperRouter.get('/getAll', auth.vertify, paperCont.getAll)

/**
 * 获取对应的答卷
 */
paperRouter.get('/getOnePaper/:paperId', auth.vertify, paperCont.getOnePaper)

/**
 * 获取所有的试题 
 */
paperRouter.get('/getAllSubjects', auth.vertify, paperCont.getAllSubjects)

/**
 * 删除试卷
 */
paperRouter.delete('/delPaper/:id', auth.vertify, paperCont.delPaper)

/**
 * 添加题目
 */
paperRouter.post('/addSubject', auth.vertify, paperCont.addSubject)


/**
 * 删除试题成功
 */
paperRouter.delete('/delSubject/:id', auth.vertify, paperCont.delSubject)

/**
 * 评卷
 */
paperRouter.post('/addAnswer', auth.vertify, paperCont.addAnswer)

/**
 * 获取答题记录
 */
paperRouter.get('/getAnswer', auth.vertify, paperCont.getAnswer)


/**
 * 获取答卷详情
 */
paperRouter.get('/getAnswerDetail/:id', auth.vertify, paperCont.getAnswerDetail)

/**
 * 获取题目记录
 */
paperRouter.get('/getSubjectRecord', auth.vertify, paperCont.getSubjectRecord)

/**
 * 搜题
 */
paperRouter.get('/search/:w', paperCont.search)

/**
 * 获取学生的答卷
 */
paperRouter.get('/stuPapers', auth.vertify, paperCont.getStuPapers)

/**
 * 获取练习题
 */
paperRouter.get('/getExec/:count', auth.vertify, paperCont.getExec)

/**
 * 获取所有的试卷的名字
 */
paperRouter.get('/getAllPaperName', auth.vertify, paperCont.getAllPaperNames)

/**
 * 获取教师试卷数据详情
 */
paperRouter.get('/getTchDataAna/:paperId', auth.vertify, paperCont.getTchDataAna)

export default paperRouter;
